package com.group4.edu.controller;

import com.study.util.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @Author:l
 * @Date:2022.03.11
 */
@RestController
@Slf4j
@RequestMapping("/edu/user")
@CrossOrigin
public class UserController {

    @PostMapping("/login")
    public ResponseResult<Map> login(){
        ResponseResult<Map> result = new ResponseResult<>();
        result.setCode(200);
        HashMap<String, String> map = new HashMap<>();
        map.put("token","token");
        result.setData(map);
        result.setMessage("suc");
        return result;
    }

    @PostMapping("/logout")
    public ResponseResult logout(){

        return ResponseResult.SUCCESS;
    }

    @GetMapping("/info")
    public ResponseResult<Map> info(){
        ResponseResult<Map> result = new ResponseResult<>();
        HashMap<String, String> map = new HashMap<>();
        map.put("roles","[roles]");
        map.put("name","admin");
        map.put("avatar","https://group4-edu.oss-cn-beijing.aliyuncs.com/edu-image/cover/R-C.jpg");
        result.setCode(200);
        result.setMessage("suc");
        result.setData(map);
        return result;
    }
}
